from agents import Runner
from dotenv import load_dotenv

from src.common_tools import getAgent, chat

load_dotenv(override=True)
async def test_llm():
    agent = getAgent("你是一个且人为乐的助手。",[])

    result = await Runner.run(agent, "请写一首关于编程中递归的俳句。")
    print("#########打印final_output\n")
    print(result.final_output)
    print("#########打印new_items\n")
    print(result.new_items)
    print("#########打印to_input_list\n")
    print(result.to_input_list)
    messages = result.to_input_list()
    messages.append({"role": "user", "content": "我上一个问题是什么？"})
    result = await Runner.run(agent, messages)
    print(result.final_output)

async def test_multi_conversation():
    agent = getAgent("你是一个且人为乐的助手。",[])
    await chat(agent)

if __name__ == "__main__":
    import asyncio
    # asyncio.run(test_llm())
    asyncio.run(test_multi_conversation())